from locust import HttpUser, task, between

class FastAPITest(HttpUser):
    wait_time = between(1, 2)  # 用户间隔时间
    host = "http://localhost:8080"  # 你的 FastAPI 地址

    @task
    def get_emp_test(self):
        self.client.get("/emps/1")  # 测试获取员工接口

    @task
    def post_login_test(self):
        self.client.post("/login", json={"username": "jinyong", "password": "123456"})